package com.party.core.model.commune;
import com.google.common.collect.Maps;
import java.util.Map;

/**
 * @program: party
 * @description: 模块类型
 * @author: Hua Qunhao
 * @create: 2020-01-08 10:20
 **/
public enum ModuleType {
    MODULE_TYPE_ACTIVITY("ACTIVITY", "活动"),
    MODULE_TYPE_CIRCLE("CIRCLE", "圈子"),
    MODULE_TYPE_PHOTO("PHOTO", "相册"),
    MODULE_TYPE_MEMBERMGMT("MEMBERMGMT", "会员管理");
    //状态码
    private String code;

    //状态值
    private String value;

    ModuleType(String code, String value) {
        this.code = code;
        this.value = value;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String getValue(Integer code){
        for (ModuleType moduleType : ModuleType.values()){
            if (moduleType.getCode().equals(code)){
                return moduleType.getValue();
            }
        }
        return null;
    }

    public static Map<String, String> convertMap(){
        Map<String, String> map = Maps.newHashMap();
        for (ModuleType moduleType : ModuleType.values()){
            map.put(moduleType.getCode(), moduleType.getValue());
        }
        return map;
    }
}
